The present invention is a computer software framework and method that provides a means to log messages to files, consoles, databases, and other destinations and combines the functions of log file formatting, message multicasting, message filtering, message severity processing and log file management.
Message logging is an example of a general application facility that is typically needed in development of software code and applications to assist with testing, debugging, trouble shooting, and the like. Computer applications typically log (e.g., write, display, send, etc.) messages to a variety of destinations such as files, screens/user displays, dialogs, databases, remote servers, consoles, and the like using various message formats. An enterprise-wide computing system typically has a number of separate computing systems linked together and hosting a variety of computer applications, leading to problems such as inability of applications to log to multiple destinations simultaneously and inconsistent message formatting for messages written to the same log. Thus, a need exists for a means to uniformly log messages across an enterprise-wide computing system to aid in the development and maintenance thereof. The current invention addresses this need by encapsulating message logging and related functions, thereby providing a uniform application programming interface (API) to the various applications and making the task of message logging much simpler from an application""s perspective. The invention abstracts the concept of a log, thereby presenting a consistent API to developers regardless of the log file type (e.g., a file log, a console log, a group log, etc.).
The present invention discloses a message logging framework, comprising a log object created by a destination log class extending a log base class and the log base class implementing a log interface, wherein the log base class comprises a method for formatting a message and the destination log class comprises a method to log the formatted message to a destination log. In a preferred embodiment, the log base class further comprises a method for filtering the message by comparing a severity attribute of the message to a filter severity criterion, wherein a message that conforms to the filter severity criterion becomes a filtered message and is (or alternatively is not) logged to the destination log and a message that does not conform to the filter severity criterion becomes an unfiltered message and is logged to the destination log. The present invention also discloses a message logging framework, comprising a group log object created by a group log class extending a log collection class and implementing a log interface, wherein the group log class comprises a method to log a message to a plurality of destination logs. In a preferred group logging embodiment, each of the plurality of destination logs further comprises a log object created by a destination log class extending a log base class and the log base class implementing a log interface, wherein the log base class comprises a method for formatting the message and the destination log class comprises a method to log the formatted message to the destination log.
The present invention further discloses a method for logging a message, comprising forming a destination log object by a destination log class extending a log base class and the log base class implementing a log interface; formatting the message; and logging the formatted message to a destination log via the destination log object. In a preferred embodiment, the logging method further comprises filtering the message by comparing a severity attribute of the message to a filter severity criterion, wherein a message that conforms to the filter severity criterion becomes a filtered message and is (or alternatively is not) logged to the destination log and a message that does not conform to the filter severity criterion becomes an unfiltered message and is logged to the destination log. The present invention also discloses a method for logging a message, comprising forming a group log object by a group log class extending a log collection class and implementing a log interface; and logging the message to a plurality of destination logs via the group log object. In a preferred group logging embodiment, the method further comprises forming a destination log object by a destination log class extending a log base class and the log base class implementing a log interface; formatting the message; and logging the formatted message to the destination log via the destination log object.